home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / gcc / libmat.lha / src / minv.cc < prev    next >
C/C++ Source or Header  |  1980-01-01  |  254b  |  18 lines

  1. //                MATRIX LIB
  2. //            TOMMY JOHANSSON 1995
  3.  
  4. #include "matrix.h"
  5. Matrix inv(const Matrix& A)
  6. {
  7.     int i,j;
  8.     Matrix x(A.n,1);
  9.     Matrix C(A.n);
  10.     for(i=1;i<=A.n;i++)
  11.     {
  12.         x=solve(A,e(A.n,i));
  13.         for(j=1;j<=A.n;j++)
  14.             C.koff[j][i]=x.koff[j][1];
  15.     }
  16.     return(C);
  17. }
  18.